<template>
  <div class="kpi-dashboard">
    <div class="dashboard-header">
      <div class="legend">
        <span class="legend-item completed">
          <span class="legend-dot"></span>
          完成率
        </span>
        <span class="legend-item pending">
          <span class="legend-dot"></span>
          剩余值
        </span>
      </div>
    </div>

    <div class="kpi-list">
      <item
          v-for="item in data"
          :key="item.id"
          :item="item"
      />
    </div>
  </div>
</template>

<script>
import item from './item.vue'

export default {
  name: 'KpiDashboard',
  components: {
    item
  },
  props: {
    data: {
      type: Array,
      required: true
    }
  }
}
</script>

<style scoped>
.kpi-dashboard {
  //background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  border-radius: 12px;
  padding: 18px 18px 18px 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dashboard-header {
  display: flex;
  justify-content: flex-end;
}

.legend {
  display: flex;
  gap: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-size: 14px;
}

.legend-dot {
  width: 30px;
  height: 4px;
  border-radius: 2px;
}

.legend-item.completed .legend-dot {
  background: linear-gradient(to right, #01a3da, #37e794);
}

.legend-item.pending .legend-dot {
  background: #4a5568;
}

.kpi-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
</style>